//
//  TableVC+Config.m
//  
//  jhf
//
//  Created by 计海峰 on 2020/8/19.
//

#import "TableVC+Config.h"
#import "TableConfigProtocol.h"

@implementation TableVC (Config)

//MARK - 刷新其它配置
- (void)refreshTableConfig {
    if ([self.vm conformsToProtocol:@protocol(TableConfigProtocol)]) {
        if ([self.vm respondsToSelector:@selector(tableViewPaddingInsets)]) {
            UIEdgeInsets padding = [[self.vm performSelector:@selector(tableViewPaddingInsets)] UIEdgeInsetsValue];
            [self.tableview mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.edges.equalTo(self.view).insets(padding);
            }];
        }
        
        if ([self.vm respondsToSelector:@selector(configController:)]) {
            [self.vm performSelector:@selector(configController:) withObject:self];
        }
        
        if ([self.vm respondsToSelector:@selector(configTableView:)]) {
            [self.vm performSelector:@selector(configTableView:) withObject:self.tableview];
        }
        
        if ([self.vm respondsToSelector:@selector(configControllerView:)]) {
            [self.vm performSelector:@selector(configControllerView:) withObject:self.view];
        }
        if ([self.vm respondsToSelector:@selector(configController:tableView:)]) {
            [self.vm performSelector:@selector(configController:tableView:) withObject:self withObject:self.tableview];
        }
    }
}

@end
